package gupao.concurrency.model;

public class ForcastContext {

    private static final ThreadLocal<TimeWindow> timeWindowThreadLocal = new ThreadLocal<>();
    private static final ThreadLocal<ForecastConfig> configThreadLocal = new ThreadLocal<>();

    public static TimeWindow getTimeWindow(){
        return timeWindowThreadLocal.get();
    }

    public static void init(ForecastConfig forcastConfig, TimeWindow timeWindow) {
        timeWindowThreadLocal.set(timeWindow);
        configThreadLocal.set(forcastConfig);
    }

    public static void clean() {
        timeWindowThreadLocal.remove();
        configThreadLocal.remove();
    }
}
